Component({
  properties: {
    bg: { type: String, value: getApp().globalData.theme },
    data: { type: Array, value: [
      { label: 'tab1', key: '1' },
      { label: 'tab2', key: '2' },
      { label: 'tab3', key: '3' },
      { label: 'tab4', key: '4' }
    ] },
    active: { type: String, value: '1' }
  },
  data: {

  },
  methods: {
    changeTab (e) {
      if (this.data.active !== e.currentTarget.dataset.key) {
        this.setData({ active: e.currentTarget.dataset.key })
        this.triggerEvent('change', this.data.active)
      }
    }
  }
})
